//统一管理项目接口的模块
//引入二次封装的axios（带有请求、响应的拦截器）
import requests from "./request";

// 判断用户是否登入 /api/login   GET    没有任何参数
export const checkUser = (loginForm) =>
  requests({ url: "/login", method: "post", data: loginForm });

//#region 物品发布页
//连表获取物品信息
export const getGoodsList = () => requests.get(`/getGoods`);

//物品发布页搜索数据
export const searchGoodList = (keyWord) =>
  requests({ url: `/searchGoodsList?keyWord=${keyWord}`, method: "get" });
// 添加物品
export const addGoodList = (goodsForm) =>
  requests({ url: `/addGoods?goodsForm=${goodsForm}`, method: "get" });
// 删除物品
export const delGoodList = (id) =>
  requests({ url: `/delGoods?id=${id}`, method: "get" });
// 根据id获取物品数据
export const getIdGoods = (id) =>
  requests({ url: `/getIdGoods?id=${id}`, method: "get" });
// 更新物品
export const updateGoodList = (goodsForm) =>
  requests({ url: `/updateGoods?goodsForm=${goodsForm}`, method: "get" });
//#endregion

//#region 用户管理页
// 获取用户列表
export const getUserList = () => requests.get(`/getUser`);
//物品发布页搜索数据
export const searchUserList = (keyWord) =>
  requests({ url: `/searchUser?keyWord=${keyWord}`, method: "get" });
//#endregion
